package org.darkforest.dao.mapper;

import org.darkforest.dao.annotation.DBMapper;
import org.darkforest.model.*;
import org.darkforest.vo.GoodsCommonPage;
import org.darkforest.vo.GoodsCommonProxyVO;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@DBMapper
public interface GoodsCommonMapper {
    int deleteByPrimaryKey(Integer goodsCommonid);

    int insert(GoodsCommonWithBLOBs record);

    int updateByPrimaryKeyWithBLOBs(GoodsCommonWithBLOBs record);

    int updateByPrimaryKey(GoodsCommon record);

    GoodsCommon selectByPrimaryKey(Integer goodsCommonid);

    List<GoodsCommon> findSimpleGoodsCommonByCond(GoodsCommon record);

    /**
     * 批量修改商品状态
     */
    void modifyGoodsStatusByBatch(Map conditionMap);


    List<GoodsCommonWithBLOBs> searchGoods(HashMap<String, String> searchCond);

    /**
     * 根据店铺统计商品数量
     * @param goods
     * @return
     */
    Integer getGoodsNum(GoodsCommon goods);

    Integer getGoodsNumByClassId(Map searchMap);

    /**
     * 获取商品详情信息，商品详情页面专用
     * @param goodsCommonId
     * @return
     */
    GoodsDetail getGoodsDetail(Integer goodsCommonId);

    List<GoodsCommon> findGoodsInState(GoodsCommonSearchBean status);

    GoodsCommonWithBLOBs getGoodsCommonWithBLOBs(Integer goodsCommonId);

    /**
     * 关联商品代理表 商品表 查询
     * @return
     * @param goodsCommonPage
     */
    List<GoodsCommonProxyVO> findGoodsForProxy(GoodsCommonPage goodsCommonPage);

    /**
     * 查询代理商品
     * @param modelPage
     * @return
     */
    List<GoodsCommonProxyVO> findProxyGoodsByPage(GoodsCommonPage modelPage);

    Integer getGoodsCount(Integer nearWeek);

    /**
     * 代理商品搜索
     * @param modelPage
     * @return
     */
    List<GoodsCommonProxyVO> searchGoodsForProxy(GoodsCommonPage modelPage);

    void updateGoodsStatus(Map<String, Object> map);

    void updateByPrimaryKeySelective(GoodsCommon goodsCommon);

    void soldOutStoreGoods(Map map);

    void goodsVerifyByBatch(Map conditionMap);

    GoodsCommonWithBLOBs getGoodsCommonWithBlobsAndGoodsById(Integer goodsCommonid);

    List<GoodsCommon> listGoodsCommonByCondition(GoodsCommonSearchBean goodsCommonSearchBean);

    void updateStoreName(GoodsCommon goodsCommon);
}